A task, job that can be submitted to a nkTasks::Thread. More...
Public Member Functions | |
Task () | |
virtual | ~Task () |
Thread * | getParentThread () const |
TASK_RESULT | getWorkResult () const |
void | setParentThread (Thread *thread) |
void | setWorkResult (TASK_RESULT result) |
virtual TASK_RESULT | onWork ()=0 |
virtual void | onWorkDone ()=0 |
virtual void | onSuccess ()=0 |
virtual void | onFail ()=0 |
virtual void | onAbort ()=0 |
A task, job that can be submitted to a nkTasks::Thread.
Any external code can implement this class, enabling it to be processed by this component.
nkTasks::Task::Task | ( | ) |
Constructor.
|
virtual |
Destructor.
Thread* nkTasks::Task::getParentThread | ( | ) | const |
TASK_RESULT nkTasks::Task::getWorkResult | ( | ) | const |
void nkTasks::Task::setParentThread | ( | Thread * | thread | ) |
Sets the parent thread for the task.
thread | The thread that will be marked as a parent for this task. |
void nkTasks::Task::setWorkResult | ( | TASK_RESULT | result | ) |
Sets the current work result for the task.
result | The task work result to attach. |
|
pure virtual |
Callback for the work that the task needs to do. This will be called in thread task has been assigned to.
Implemented in nkGraphics::ResourceTask, and nkTasks::LambdaTask.
|
pure virtual |
Callback called after onWork() has been done. This will be called in thread task has been assigned to.
Implemented in nkGraphics::ResourceTask, and nkTasks::LambdaTask.
|
pure virtual |
Callback for work that has returned a TASK_RESULT::SUCCESS code. Only called if task has been submitted to a scheduler. It will be called from the thread owning the scheduler.
Implemented in nkGraphics::ResourceTask, and nkTasks::LambdaTask.
|
pure virtual |
Callback for work that has returned a TASK_RESULT::FAIL code. Only called if task has been submitted to a scheduler. It will be called from the thread owning the scheduler.
Implemented in nkGraphics::ResourceTask, and nkTasks::LambdaTask.
|
pure virtual |
Callback for work that has returned a TASK_RESULT::ABORT code. Only called if task has been submitted to a scheduler. It will be called from the thread owning the scheduler.
Implemented in nkGraphics::ResourceTask, and nkTasks::LambdaTask.